package com.hllxd.hism.star.basic.service.model;

import com.github.pagehelper.PageInfo;
import lombok.Getter;

import java.util.List;

/**
 * 结果实体
 * <p> 支持使用PageHelper做分页 </p>
 * <p> rows和total这两个字段是bootStrap-table做分页时的两个默认字段 </p>
 *
 * @author liuxiongbo
 * @date 2020/12/31 14:34
 **/
@Getter
public class ResultEntity<T> {
    private final List<T> rows;
    private Long total = 0L;

    public ResultEntity(List<T> rows) {
        this.rows = rows;
        this.total = new PageInfo<>(rows).getTotal();
    }

    public ResultEntity(List<T> rows, Long total) {
        this.rows = rows;
        this.total = total;
    }
}
